package Work0526;

public class Billion {

	public static void main(String[] args) {
		boolean q = true;
		int s = 1;
		for (int a = 2; a <= 2100000000; a++) {
			for (int b = 2; b * b < a; b++) {
				if (a % b == 0) {
					q = false;
				}
			}
			if (q == true) {
				// System.out.println(a);
				for (int c = 2; c * c < a; c++) {
					for (int d = 1; s - 1 <= a; d++) {
						s *= c;
						if (s - 1 == a) {
							System.out.println(a);
						}
					}
					s = 1;
				}

			}
			q = true;
		}

	}

}
